<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>签到管理-登陆</title>
    <link rel="stylesheet" href="layui/css/layui.css">
    <link rel="stylesheet" href="css/admin.css">
</head>
<body>
<div id="container">
    <div></div>
    <div class="admin-login-background">
        <!--<div class="admin-header">-->
        <!--<img src="image/ex_logo.png" class="admin-logo">-->
        <!--</div>-->
        <form class="layui-form" action="" lay-filter="example">
            <div>
                <i class="layui-icon layui-icon-username admin-icon admin-icon-username"></i>
                <input type="text" name="account" placeholder="请输入用户名"
                       autocomplete="off"
                       class="layui-input admin-input admin-input-username">
            </div>
            <div>
                <i class="layui-icon layui-icon-password admin-icon admin-icon-password"></i>
                <input type="password" name="password"
                       placeholder="请输入密码"
                       autocomplete="off"
                       class="layui-input admin-input">
            </div>
            <div style="float: right;margin-top: 10px;color: red" id="bt_reg">注册</div>
            <button type="button" class="layui-btn  admin-button" id="bt_login">登录</button>


        </form>
    </div>
</div>
<script src="layui/layui.js"></script>
<script src="contance.js"></script>
<script>
    layui.use(['form', 'layedit', 'laydate',"upload",], function(){
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,upload = layui.upload
            ,laydate = layui.laydate;




        //表单取值
        layui.$('#bt_login').on('click', function(){
            var data = form.val('example');
            layui.jquery.ajax({
                url:baseurl+"/login",
                data:{"pwd":data.password,"account":data.account},
                type:"Post",
                success:function(result){
                    console.log(result);
                    if (result.data!=null){
                        layer.msg("登录成功");
                        layui.data('user', {
                            key: 'id'
                            ,value: result.data.id
                        });
                        layui.data('user', {
                            key: 'name'
                            ,value: result.data.name
                        });
                        location.href="index.html";
                    }else {
                        layer.msg("工号或者密码不正确");
                    }


                },
                error:function(result){
                    // $.messager.alert('错误',result.msg);
                }
            });


        });
        //表单取值
        layui.$('#bt_reg').on('click', function(){
            location.href="reg.html";


        });

    });
</script>




</body>
</html>
